package com.codeduck.utils;

import java.net.InetAddress;
import java.net.UnknownHostException;

/**
 * @auther Mahone Yan
 * @date 2023/5/7
 */
public class NetworkUtils {

    public static String getIP() {
        String hostAddress = "127.0.0.1";
        try {
            InetAddress ipAddress = InetAddress.getLocalHost();
            hostAddress = ipAddress.getHostAddress();
        } catch (UnknownHostException e) {
            e.printStackTrace();
        }
        return hostAddress;
    }
}
